<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <script src="./js-source/jquery.js"></script>
    <script src="./firstPage-js/jquery.easyui.min.js"></script>

    <link href="./firstPage-css/home_min.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="./firstPage-css/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="./firstPage-css/themes/icon.css">



    <script type="text/javascript">
        $(function () {

            var m_url = 'http://localhost:3000/';

            var str = $('#resultText', window.parent.document).val(); //获取文字
            $('#iteam-h1').html('查询结果：' + str + '信息') //设置显示的文字值

            if (str == '最近24小时内灾害') {
                m_url = 'http://localhost:3000/selectList_24hour'
            }
            if (str == '最近48小时内灾害') {
                m_url = 'http://localhost:3000/selectList_48hour'
            }
            if (str == '最近7天内灾害') {
                m_url = 'http://localhost:3000/selectList_7day'
            }
            if (str == '最近30天内灾害') {
                m_url = 'http://localhost:3000/selectList_30day'
            }
            if (str == '最近一年内灾害') {
                m_url = 'http://localhost:3000/selectList_1year'
            }
            if (str == '地震历史详情') {
                m_url = 'http://localhost:3000/selectList_history_earthquake'
                 
            }
            if (str == '山地滑坡历史详情') {
                m_url = 'http://localhost:3000/selectList_history_landslide'
                 
            }
            if (str == '火灾历史详情') {
                m_url = 'http://localhost:3000/selectList_history_fire'
                 
            }

            if (str == '历史查询') {
                var m_date1, m_date2
                var weidu1 = $('#weidu1', window.parent.document).val();
                var weidu2 = $('#weidu2', window.parent.document).val();
                var jingdu1 = $('#jingdu1', window.parent.document).val();
                var jingdu2 = $('#jingdu2', window.parent.document).val();

                var m_date1 = $('#time_1', window.parent.document).val();
                var m_date2 = $('#time_2', window.parent.document).val();

                m_url = 'http://localhost:3000/selectList_history_search?date1=' + m_date1 + "&date2=" +
                    m_date2 + "&weidu1=" + weidu1 + "&weidu2=" + weidu2 + "&jingdu1=" + jingdu1 + "&jingdu2=" +
                    jingdu2

            }
            a(m_url);

            function a(m_url) {
                $.ajax({
                    url: m_url,
                    type: 'get',
                    success: function (data) {
                        // var tab = $('#m_table');
                        // tab.innerHTML += "<tr> <td align='center'>2018-11-12 10:26:42</td> <td align='center'>28.23</td> <td align='center'>104.96</td> <td align='left'><a href='http://news.ceic.ac.cn/CD20181112102642.html' align='center'>四川宜宾市兴文县</a></td> </tr>"
                        // var tradd = tab.insertRow(3);
                        // tradd.style.background = 'green';
                        // tradd.innerHTML = '<td>新增01</td><td>新增02</td><td>新增03</td>';
                        // var str = $('#m_table').html();
                        for (i = 0; i < data.length; i++) {
                            // var editTable = $('#m_table');

                            /*
                            获取的是tbody
                            */
                            var editTable=document.getElementById("m_table");

                            if(data[i]){
                                if(i%2 == 0){
                                    editTable.innerHTML += "<tr> <td align='center'>"+data[i].created_time+"</td> <td align='center'>"+data[i].lat+"</td> <td align='center'>"+data[i].long+"</td> <td align='center'>"+data[i].name+"</td> </tr>"
                                }else{
                                    editTable.innerHTML += "<tr class='tr-red' style='background-color: #eeeeee;font-weight: bold;'> <td align='center'>"+data[i].created_time+"</td> <td align='center'>"+data[i].lat+"</td> <td align='center'>"+data[i].long+"</td> <td align='center'>"+data[i].name+"</td> </tr>"
                                }
                            }

                        }
                    }
                })
            }
        })
    </script>

</head>

<body>
    <div class="title-content">
        <h2 class="iteam-h1">
            <div id="iteam-h1"> </div>
            <!-- <a href="javascript:void(0)" class="check onmap" id="show" rel="">显示到地图</a>
            <a href="javascript:void(0)" class="check ontext" id="save" rel="">保存到本地</a> -->
        </h2>
        <!--                    <h1 class="iteam-h1">查询结果：-->
        <!--<a id="show" class="onbutton onmap" rel="" href="javascript:void(0)">显示在地图上</a>-->
        <!--                        <a id="save" class="onbutton ontext" href="javascript:void(0)" rel="">保存为文本</a></h1>-->
        <div class="speedquery">
            <div id="speed-search">
                <table id='m_table' border="0" cellpadding="0" cellspacing="0" class="speed-table1">
                    <tr class="speed-tr-h1" >
                        <th>发震时刻(UTC+8)</th>

                        <th>纬度(°)</th>
                        <th>经度(°)</th>
                        <th style="align-items: center">参考位置</th>
                        <!--                                <th width="85">操作</th>-->
                    </tr>
                </table>
            </div>
            <p class="pagenum" id="pagenum">当前页:1　总页数:1</p>
            <div id="paging">
            </div>
        </div>
        <!--speedquery-->
    </div>
    </div>
    <!--prop-->
</body>

</html>